package interviewpreparationkit.dictionary

import org.junit.jupiter.api.Test
import redirectSystemIn
import redirectSystemOut
import java.util.*

class SherlockAndAnagramsTests {
    @Test
    fun sherlockAndAnagramsTest() {
        redirectSystemIn(this.javaClass) {
            redirectSystemOut {
                val scan = Scanner(System.`in`)
                while (scan.hasNextLine()) {
                    val q = scan.nextLine().trim().toInt()

                    for (qItr in 1..q) {
                        val s = scan.nextLine()

                        val result = sherlockAndAnagrams(s)

                        println(result)
                    }
                    for (qItr in 1..q) {
                        it.add(scan.nextLine().trim())
                    }
                }
            }
        }
    }
}